<template>
	<view class="container">
		<view class="video">
			<video
				id="myVideo"
				class="video"
				:title="lesson.name"
				:poster="lesson.image"
				:src="lesson.video"
				:enable-progress-gesture="false"
				object-fit="contain"
				controls
			></video>
		</view>
		<view class="section">
			<view class="p-40">
				<view class="section__title">课程介绍</view>
				<view class="section__entitle mt-20">Course Introduction</view>
				<view class="section-content mt-30">
					<rich-text :nodes="lesson.content"></rich-text>
				</view>
			</view>
		</view>
		<view style="height: 80rpx"></view>
	</view>
</template>

<script>
import { getLessonDetail } from '@/api/index';
import $tools from '@/utils/common';
export default {
	data() {
		return {
			title: 'Hello',
			id: 0,
			lesson: {},
		};
	},
	onShareAppMessage() {},
	onShareTimeline() {},
	onLoad(options) {
		this.id = options.id;
		this.getInit();
	},
	onShow() {},
	onReachBottom() {},

	onPullDownRefresh() {},
	methods: {
		getInit() {
			const param = {
				id: this.id,
			};
			getLessonDetail(param).then((res) => {
				console.log(res);
				this.lesson = res.data;
				this.lesson.content = $tools.formatRichText(res.data.content);
			});
		},
	},
};
</script>

<style lang="scss">
@import 'lesson.scss';
</style>
